Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App router: Allow types for page params/searchParams for pages wrapped by withPageAuthRequired #1764

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andrinheusser
Copy link

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

This PR contains only changes to types.

Using NextJs 14, you may now type your Pages wrapped by withPageAuthRequired

export default withPageAuthRequired(
  async function Home({
    params,
    searchParams: { limit },
  }: {
    searchParams: { limit: string };
    params: { lang: string; slug: string };
  }) {
    console.log(params, limit);
    return <div />;
  },
  {
    returnTo: ({ params, searchParams }) =>
      `/${params.lang}?limit=${searchParams.limit}`,
  }
)

previously, this would generate type errors: (@auth0/nextjs-auth0 3.5.0)
image

📎 References

This should close https://github.com/auth0/nextjs-auth0/pull/1750/files

🎯 Testing

  • added tests for types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant